﻿namespace iFinance.Infrastructure.Services
{
    using System.Windows.Controls;
    using Microsoft.Practices.Prism.ViewModel;

    /// <summary>
    /// ChildWindow服务接口
    /// </summary>
    public interface IChildWindowService
    {
        /// <summary>
        /// 注册ChildWindow
        /// </summary>
        /// <typeparam name="TViewModel">ChildWindow对应的ViewModel的类型.</typeparam>
        /// <typeparam name="TChildWindow">ChildWindow的类型</typeparam>
        void Register<TViewModel, TChildWindow>()
            where TViewModel : NotificationObject
            where TChildWindow : ChildWindow;

        /// <summary>
        /// 创建ChildWindow
        /// </summary>
        /// <typeparam name="TViewModel">ChildWindow对应的ViewModel的类型.</typeparam>
        /// <returns></returns>
        ChildWindow Resolve<TViewModel>()
            where TViewModel : NotificationObject;

        /// <summary>
        /// 创建并显示ChildWindow
        /// </summary>
        /// <typeparam name="TViewModel">ChildWindow对应的ViewModel的类型.</typeparam>
        /// <param name="viewModel">所需要的ViewModel</param>
        /// <returns></returns>
        bool ResolveAndShow<TViewModel>(TViewModel viewModel)
            where TViewModel : NotificationObject;
    }
}
